package com.cn.yang.servlet.aboutUs;

import com.alibaba.fastjson.JSONObject;
import com.cn.yang.model.aboutUs.AboutUsModel;
import com.cn.yang.service.AboutUsService;
import com.cn.yang.service.impl.AboutUsServiceImpl;
import com.cn.yang.util.PageUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/back/aboutUs/findAboutUs")
public class FindAboutUsServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8");
        resp.setCharacterEncoding("UTF-8");

        AboutUsService service = new AboutUsServiceImpl();
        PageUtil pageUtil = new PageUtil();
        AboutUsModel model = new AboutUsModel();
        model.setPageUtil(pageUtil);
        AboutUsModel list = service.findAboutUs(model);
        // int count = service.countAboutUs();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("list",list);
        // jsonObject.put("count",count);
        resp.getWriter().println(jsonObject);
    }
}
